# 1、a=3  b=5 将a与b的值交换
a = 3
b = 5
c = a
a = b
b = c
print(f'a的值：{a},b的值：{b}')

# 2.计算>80分的学生的平均分
score_list = [78,84,86,49,95,56,70]
over_80list =[]
def over_80(score_list):
    score_standard = 80
    for i in score_list:
        if i > score_standard:
            over_80list.append(i)
    return over_80list


result = over_80(score_list)
# print(f'超过80的分数：{result}')

def average_over_80(scores):
    sum = 0
    for i in scores:
        sum += i
    return int(sum/len(scores))


average_result = average_over_80(score_list)
print(f'所有人的平均数：{average_result}')



# 3、假设计你是要给自动给客户发邮件的运营
# 下面的是客户的订单数据：
orders = [
    {"buyer_name": "Pony","product": "MacBook"},
    {"buyer_name": "Bill","product": "AirPods"},
    {"buyer_name": "Hank","product": "iPhone"}
]
# 写一个函数 deliver_mail 接收客户姓名，产品名，然后输出下面格式的邮件：
# Dear [用户姓名]:
# Your purchased product : [产品名] is delivered!
# Thanks for your choosing!
# 遍历orders, 调用 deliver_mail 函数，生成3封邮件
def deliver_mail(buyer_name,product):
    print(f'Dear {buyer_name}:\nYour purchased product : {product} is delivered!\nThanks for your choosing!')


for i in orders:
    # print(i["buyer_name"])
    # print(i["product"])
    deliver_mail(i["buyer_name"],i["product"])










# 4、你现在公司的销售经理，要对一些销售数据进行分析
# 公司有百亿条销售数据，抽出一些销售额信息让你练手
sales = [100,200,50,300,20,500,1000,10]
# 请对 sales 进行升序排序，并且打印出来
# 请对 sales 进行降序排序，并且打印出来
# 请用排序+切片的方式，找出 Top3 的销售额
# 请用排序+切片的方式，找出 最低的3个销售额
sales.sort()
print('升序后列表:',sales)
sales.sort(reverse=True)
print('降序后列表：',sales)
Top_high3_list = sales[:3]
print(Top_high3_list)
Top_low3_list = sales[-3:]
print(Top_low3_list)

